package com.health.tablebean.webservice;

import android.content.Context;

import com.health.NovaApplication;
import com.health.db.FDbManager;
import com.health.tablebean.ARCHIVE_BASEINFO;
import com.health.tablebean.CHILD_THREE2SIX_YEAR_OLD;
import com.health.tablebean.CHILD_WITHIN_ONE_YEAR_OLD;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/2/11 0011.
 */

public class ChildThree2SixYearOld {
    private String avoirdupois;//儿童体重的测量值，计量单位为kg
    private String visitDate;//随访日期
    private String ageAvoirdupois;//年龄别体重评价结果代码，DM01-39_1 上，DM01-39_2 中，DM01-39_3 下
    private String stature;//身长(cm)
    private String ageStature;//年龄别身高评价结果代码，DM01-39_1 上，DM01-39_2 中，DM01-39_3 下
    private String headSize;//儿童头围的测量值，计量单位为cm
    private String complexion;//面色检查结果代码,DM05-14_1_1 红润，DM05-14_1_2 黄染，DM05-14_1_3 其他
    private String skinCheck;//皮肤检查结果代码，DM01-40_1 异常，DM01-40_2 未见异常
    private String bregmaState;//前囟闭合标志DM05-16_1_1 闭合，DM05-16_1_2 未闭合
    private String bregmaSize1;//前囟横径的测量值，计量单位为cm
    private String bregmaSize2;//前囟纵径的测量值，计量单位为cm
    private String cervixCheck;//颈部包块DM01-11_1 无，DM01-11_2 有
    private String stoopPsy;//可疑佝偻病症状代码组合DM05-21_1 无，DM05-21_2 夜惊，DM05-21_3 多汗，DM05-21_4 烦躁
    private String rachitis;//可疑佝偻病体征代码组合，DM05-19_1_1 无，DM05-19_1_2 颅骨软化
    private String mouthCheck;//口腔检查异常标志DM01-40_1 未见异常，DM01-40_2 异常
    private String heartCheck;//胸部听诊检查结果DM01-40_1 未见异常，DM01-40_2 异常
    private String bellyCheck;//腹部触诊检查结果DM01-40_1 未见异常，DM01-40_2 异常
    private String umbilicalCord;//脐带检查结果,DM05-18_1 未脱,DM05-18_2 脱落,DM05-18_3 脐部有渗出,DM05-18_4 其他
    private String limbDisease;//四肢活动度标志DM01-40_1 未见异常，DM01-40_2 异常
    private String genitaliaCheck;//肛门/外生殖器检查结果DM01-40_1 未见异常，DM01-40_2 异常
    private String outdoorActivity;//每天户外活动时间，计量单位为小时
    private String appendD;//服用维生素D 单位为（IU/d）
    private String growthCheck;//发育评估,DM05-26_1_1 对很大声音没有反应,DM05-26_1_2 逗引时不发音或不会微笑,DM05-26_1_3 不注视人脸，不追视移动人或物品,DM05-26_1_4 俯卧时不会抬头
    private String betweenVisitDisease;//标识在对儿童进行两次随访之间是否有患病, DM01-11_1 无，DM01-11_2有
    private String pneumoniaNum;//二次体检间肺炎次数
    private String diarrheaNum;//二次体检间腹泻次数
    private String traumaNum;//二次体检间外伤次数
    private String otherDisease;//其他疾病描述
    private String outDiagnose;//转诊标志DM01-11_1 无，DM01-11_2有
    private String childrenGuideType;//儿童健康指导类别代码，DM05-04_1科学喂养，DM05-04_3生长发育，DM05-04_4疾病预防，DM05-04_5预防伤害，DM05-04_6口腔保健，DM05-04_9其他
    private String guideOther;//指导其他
    private String nextVisitDate;//下次随访日期
    private String reportDoctor;//随访医生签名
    private String creater;//创建人
    private String createorg;//创建机构
    private String personalid;//城乡居民健康档案编号
    private String age;//月龄
    private Rollout rollOut;
    private String IS_UPDATE;

    public String getIS_UPDATE() {
        return IS_UPDATE;
    }

    public void setIS_UPDATE(String IS_UPDATE) {
        this.IS_UPDATE = IS_UPDATE;
    }

    public Rollout getRollOut() {
        return rollOut;
    }

    public void setRollOut(Rollout rollOut) {
        this.rollOut = rollOut;
    }

    public String getAvoirdupois() {
        return avoirdupois;
    }

    public void setAvoirdupois(String avoirdupois) {
        this.avoirdupois = avoirdupois;
    }

    public String getVisitDate() {
        return visitDate;
    }

    public void setVisitDate(String visitDate) {
        this.visitDate = visitDate;
    }

    public String getAgeAvoirdupois() {
        return ageAvoirdupois;
    }

    public void setAgeAvoirdupois(String ageAvoirdupois) {
        this.ageAvoirdupois = ageAvoirdupois;
    }

    public String getStature() {
        return stature;
    }

    public void setStature(String stature) {
        this.stature = stature;
    }

    public String getAgeStature() {
        return ageStature;
    }

    public void setAgeStature(String ageStature) {
        this.ageStature = ageStature;
    }

    public String getHeadSize() {
        return headSize;
    }

    public void setHeadSize(String headSize) {
        this.headSize = headSize;
    }

    public String getComplexion() {
        return complexion;
    }

    public void setComplexion(String complexion) {
        this.complexion = complexion;
    }

    public String getSkinCheck() {
        return skinCheck;
    }

    public void setSkinCheck(String skinCheck) {
        this.skinCheck = skinCheck;
    }

    public String getBregmaState() {
        return bregmaState;
    }

    public void setBregmaState(String bregmaState) {
        this.bregmaState = bregmaState;
    }

    public String getBregmaSize1() {
        return bregmaSize1;
    }

    public void setBregmaSize1(String bregmaSize1) {
        this.bregmaSize1 = bregmaSize1;
    }

    public String getBregmaSize2() {
        return bregmaSize2;
    }

    public void setBregmaSize2(String bregmaSize2) {
        this.bregmaSize2 = bregmaSize2;
    }

    public String getCervixCheck() {
        return cervixCheck;
    }

    public void setCervixCheck(String cervixCheck) {
        this.cervixCheck = cervixCheck;
    }

    public String getStoopPsy() {
        return stoopPsy;
    }

    public void setStoopPsy(String stoopPsy) {
        this.stoopPsy = stoopPsy;
    }

    public String getRachitis() {
        return rachitis;
    }

    public void setRachitis(String rachitis) {
        this.rachitis = rachitis;
    }

    public String getMouthCheck() {
        return mouthCheck;
    }

    public void setMouthCheck(String mouthCheck) {
        this.mouthCheck = mouthCheck;
    }

    public String getHeartCheck() {
        return heartCheck;
    }

    public void setHeartCheck(String heartCheck) {
        this.heartCheck = heartCheck;
    }

    public String getBellyCheck() {
        return bellyCheck;
    }

    public void setBellyCheck(String bellyCheck) {
        this.bellyCheck = bellyCheck;
    }

    public String getUmbilicalCord() {
        return umbilicalCord;
    }

    public void setUmbilicalCord(String umbilicalCord) {
        this.umbilicalCord = umbilicalCord;
    }

    public String getLimbDisease() {
        return limbDisease;
    }

    public void setLimbDisease(String limbDisease) {
        this.limbDisease = limbDisease;
    }

    public String getGenitaliaCheck() {
        return genitaliaCheck;
    }

    public void setGenitaliaCheck(String genitaliaCheck) {
        this.genitaliaCheck = genitaliaCheck;
    }

    public String getOutdoorActivity() {
        return outdoorActivity;
    }

    public void setOutdoorActivity(String outdoorActivity) {
        this.outdoorActivity = outdoorActivity;
    }

    public String getAppendD() {
        return appendD;
    }

    public void setAppendD(String appendD) {
        this.appendD = appendD;
    }

    public String getGrowthCheck() {
        return growthCheck;
    }

    public void setGrowthCheck(String growthCheck) {
        this.growthCheck = growthCheck;
    }

    public String getBetweenVisitDisease() {
        return betweenVisitDisease;
    }

    public void setBetweenVisitDisease(String betweenVisitDisease) {
        this.betweenVisitDisease = betweenVisitDisease;
    }

    public String getPneumoniaNum() {
        return pneumoniaNum;
    }

    public void setPneumoniaNum(String pneumoniaNum) {
        this.pneumoniaNum = pneumoniaNum;
    }

    public String getDiarrheaNum() {
        return diarrheaNum;
    }

    public void setDiarrheaNum(String diarrheaNum) {
        this.diarrheaNum = diarrheaNum;
    }

    public String getTraumaNum() {
        return traumaNum;
    }

    public void setTraumaNum(String traumaNum) {
        this.traumaNum = traumaNum;
    }

    public String getOtherDisease() {
        return otherDisease;
    }

    public void setOtherDisease(String otherDisease) {
        this.otherDisease = otherDisease;
    }

    public String getOutDiagnose() {
        return outDiagnose;
    }

    public void setOutDiagnose(String outDiagnose) {
        this.outDiagnose = outDiagnose;
    }

    public String getChildrenGuideType() {
        return childrenGuideType;
    }

    public void setChildrenGuideType(String childrenGuideType) {
        this.childrenGuideType = childrenGuideType;
    }

    public String getGuideOther() {
        return guideOther;
    }

    public void setGuideOther(String guideOther) {
        this.guideOther = guideOther;
    }

    public String getNextVisitDate() {
        return nextVisitDate;
    }

    public void setNextVisitDate(String nextVisitDate) {
        this.nextVisitDate = nextVisitDate;
    }

    public String getReportDoctor() {
        return reportDoctor;
    }

    public void setReportDoctor(String reportDoctor) {
        this.reportDoctor = reportDoctor;
    }

    public String getCreater() {
        return creater;
    }

    public void setCreater(String creater) {
        this.creater = creater;
    }

    public String getCreateorg() {
        return createorg;
    }

    public void setCreateorg(String createorg) {
        this.createorg = createorg;
    }

    public String getPersonalid() {
        return personalid;
    }

    public void setPersonalid(String personalid) {
        this.personalid = personalid;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    /**
     * 三到六岁
     * @param context
     * @param flag
     * @return
     */
    public static List<ChildThree2SixYearOld> convertData(Context context, String flag) {
        List<ChildThree2SixYearOld> datas = new ArrayList<>();

        FDbManager fdb = FDbManager.getInstance(context);
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        List<CHILD_THREE2SIX_YEAR_OLD> infos = fdb.findAllByWhere(CHILD_THREE2SIX_YEAR_OLD.class,
                "IS_UPDATE='" + "Y' AND CREATER='" + NovaApplication.getJgrno() + "'AND FLAG='" + flag + "'");
        if (infos != null && !infos.isEmpty()) {
            ChildThree2SixYearOld data = null;
            for (CHILD_THREE2SIX_YEAR_OLD info : infos) {
                data = new ChildThree2SixYearOld();
//                满月 1 三月龄2六月龄3八月龄4
                if ("3".equals(flag)) {
                    data.setAge("36");
                }else if ("4".equals(flag)){
                    data.setAge("48");
                }else if ("5".equals(flag)){
                    data.setAge("60");
                }else if ("6".equals(flag)){
                    data.setAge("72");
                }
                data.setAgeAvoirdupois(info.getWEIGHT_ANALYSIS());
                data.setAgeStature(info.getSTATURE_ANALYSIS());
                data.setAppendD("");
                data.setAvoirdupois(info.getWEIGHT());
                data.setBellyCheck(info.getSTOMACH());
                data.setBetweenVisitDisease(info.getAMONG_TWO_FOLLO_NONE());
                data.setBregmaSize1("");
                data.setBregmaSize2("");
                data.setBregmaState("");
                data.setCervixCheck("");
                data.setChildrenGuideType(info.getGUIDANCE());
                data.setComplexion("");
                data.setCreateorg(info.getCREATEORG());
                data.setCreater(info.getCREATER());
                data.setDiarrheaNum(info.getDIARRHOEA_FREQUEN());
                data.setGenitaliaCheck("");
                data.setGrowthCheck(info.getAUXE_ESTIMATE());
                data.setGuideOther(info.getGUIDANCE_OTHER());
                data.setHeadSize("");
                data.setHeartCheck(info.getHEART_LUNG());
                data.setLimbDisease("");
                data.setMouthCheck("");
                data.setNextVisitDate(formatter.format(info.getNEXT_FOLLOWUP_DATE()));
                data.setOtherDisease(info.getAMONG_TWO_FOLLO_OTHER());
                data.setOutDiagnose(info.getREFERRAL_REASON());
                data.setOutdoorActivity("");
                String idcard = info.getIDCARD();
                List<ARCHIVE_BASEINFO> baseinfos = fdb.findAllByWhere(ARCHIVE_BASEINFO.class,
                        "IDCARD ='" + idcard + "'");
                if (baseinfos.size() > 0) {
                    ARCHIVE_BASEINFO baseinfo = baseinfos.get(0);
                    data.setPersonalid(baseinfo.getARCHIVEID());
                } else {
                    data.setPersonalid("");
                }
                data.setPneumoniaNum(info.getPNEUMONIA_FREQUEN());
                data.setRachitis("");
                data.setReportDoctor(info.getFOLLOWUP_DOCTOR_SIGN());
                data.setSkinCheck("");
                data.setStature(info.getSTATURE());
                data.setStoopPsy("");
                data.setUmbilicalCord("");
                data.setVisitDate(formatter.format(info.getFOLLOWUP_DATE()));
                Rollout rollOut = new Rollout();
                rollOut.setHpc(info.getREFERRAL_REASON());
                rollOut.setRollInRegion(info.getAGENCIES_DEPARTMENTS());
                data.setRollOut(rollOut);
                datas.add(data);
            }
        }

        return datas;
    }

}
